<template></template>
<script setup lang="ts">
import { getLineUrl } from '@/server/home'
import { useRouter } from "vue-router";
import { onBeforeMount } from 'vue';
import { ElMessage } from 'element-plus';
const router = useRouter()
const hash: any = location.href.split("/")
const hostname: string = location.hostname
const getUrl = async () => {
  try {
    const url = await getLineUrl(hash.pop(), hostname)
    console.log("🚀 ~ getUrl ~ url:", url)
    location.href = url
  } catch (err: any) {
    ElMessage.error(err.error.message)
    setTimeout(() => {
      location.href = 'https://www.google.co.uk/'
    }, 1000);
  }
}
getUrl()
onBeforeMount(() => {
  console.log(document.title)
  document.title = hash
})

</script>